// WindowCustomGUI.java by Matt Fritz
// June 2, 2010
// Handles the internal "New GUI Window" window

package customWindows;

import java.util.ArrayList;

import interfaces.BasicJComponent;

import javax.swing.JInternalFrame;

import structs.ComponentProperty;

public class WindowCustomGUI extends JInternalFrame implements BasicJComponent
{
	private String defaultTitleText = "New GUI Window";
	
	public WindowCustomGUI()
	{
		setDefaultProperties(defaultTitleText);
	}
	
	public WindowCustomGUI(String titleText)
	{
		setDefaultProperties(titleText);
	}
	
	// set the default window properties
	private void setDefaultProperties(String titleText)
	{
		setDefaultCloseOperation(JInternalFrame.HIDE_ON_CLOSE); // hide the window when it's closed
		setMaximizable(true); // can be maximized
		setClosable(true); // can be closed
		setIconifiable(true); // can be minimized (iconified)
		setTitle(titleText);
		setBounds(200,0,400,400);
		setVisible(true);
		try
		{
			setSelected(true);
		}
		catch(Exception e) {}
	}
	
	// get the basic properties of this component
	public ArrayList<ComponentProperty> getBasicProperties()
	{
		ArrayList<ComponentProperty> properties = new ArrayList<ComponentProperty>();
		
		properties.add(new ComponentProperty("(Name)", getTitle().replace(" ", "")));
		properties.add(new ComponentProperty("Height", getBounds().height));
		properties.add(new ComponentProperty("Width", getBounds().width));
		properties.add(new ComponentProperty("X", getBounds().x));
		properties.add(new ComponentProperty("Y", getBounds().y));
		properties.add(new ComponentProperty("Background", getBackground()));
		
		return properties;
	}
}
